import request from '@/router/axios';

export const list = (data) => request({
    url: '/task-order/list',
    method: 'post',
    data
}).then(data => {
    data.rows && data.rows.forEach(row => {
        if (row.TaobaoOrderNo) {
            row.TaobaoOrderNo = row.TaobaoOrderNo.substr(-6);
        }
        row.Price = (row.Price / 100).toFixed(2);
        row.Award = (row.Award / 100).toFixed(2);
    });
    return data;
});

export const update = (data) => request({
    url: '/task-order/update',
    method: "post",
    data
});
export function resolveTaskOrder(ids) {
    return request.post('/task-order/resolve-orders', {
        Id: ids
    });
}

export function rejectTaskOrders(ids, notes) {
    return request.post('/task-order/reject-orders', {
        Id: ids,
        Notes: notes
    });
}


export function refundTaskOrder(ids) {
    return request.post('/task-order/refund-orders', {
        Id: ids
    });
}
export function exportOrders(data) {
    return request.post('/task-order/export', data);
}
